<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="description"
	content="叫上海[半价菜][送可乐]樱花日本料理外卖上外卖超人,全球领先订餐平台，提供宋园路地铁站
网上订餐,  [半价菜][送可乐]樱花日本料理外卖菜单, [半价菜][送可乐]樱花日本料理每日特价。马上登陆外卖超人，轻松三步即刻享受周边美食！" />
<meta name="viewport" content="user-scalable=no">

<meta name="google-site-verification"
	content="BstJA3X9z6f9HcvoN9AZTwaKo_9Abj_j7dVBPfy640s" />
<meta name="baidu-site-verification" content="IYCrtVH0i1" />
<meta property="wb:webmaster" content="239d3d1dbdde1b2c" />
<link rel="icon" type="image/png"
	href="${pageContext.request.contextPath }/images/favicon.ico" />

<script type="text/javascript">
	(function(document, screen) {
		if (screen.width < 760) {
			document.location.href = "/mobile/";
		}
	}(document, screen));
</script>

<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/common.css?v=2015-5-20" />

<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/menuPage.css?v=2015-5-20" />


<title>店铺商品</title>
</head>
<body class="day " ng-controller="bodyCtrl" day-or-night>
	<section class="common-back" id="wrapBackground">

		<header id="header">
			<div class="common-width clearfix">
				<h1 class="fl">
					<a class="logo base-logo" href="index.html">外卖超人</a>
				</h1>

				<ul class="member" login-box>
					<li><a href="index.html" class="index">首页</a></li>
					<li class="login-register"><a href="login.html" referer-url
						class="login" rel="nofollow">登录</a><span class="cg">/</span><a
						href="register.html" referer-url rel="nofollow" class="register">注册</a></li>
					<li><a href="member_order.html" class="order-center"
						rel="nofollow">查看订单</a></li>

				</ul>

			</div>
		</header>




		<section class="menupage-main common-width" ng-init="city_name='厦门'">

			<header class="nav clearfix">
				<div class="fl clearfix nav-des">
					<img src="${pageContext.request.contextPath }/images/01.jpg" alt="[半价菜][送可乐]樱花日本料理" class="fl" />
					<div class="fl nav-des-text">
						<h2 class="ellipsis" title="[半价菜][送可乐]樱花日本料理">樱花日本料理</h2>
						<div class="clearfix">
							<div class="fl nav-review">
								<div style="width: 65.00px;"></div>
							</div>
							<p class="nav-review-x">5星</p>
						</div>
					</div>
				</div>		
			</header>
			
			
			<ul class="clearfix menu-nav-list" scroll-position-static="160">
				<li><a href="${pageContext.request.contextPath }/food/list">菜单</a></li>
				<li class="active"><a href="addFood.jsp">添加菜品</a></li>

			</ul>
			<form action="addFood">
			<div class="page-container"
				style="margin-top: 50px; margin-left: 100px">
				
					<input type="hidden" id="foodPic" name="foodPic" >


					<div class="row cl">
						<label><span style="color: red">*</span>菜品名称：</label> <input
							type="text" class="input-text" placeholder="请输入菜品名称"
							id="foodName" name="foodName" >
							<lable style="color: red" id="msg"></lable>			
					</div>
					
					<br />
					<div class="row cl">
						<label class="form-label col-xs-4 col-sm-2"><span
							style="color: red">*</span>菜品类别：</label> <span class="select-box">
							<select name="foodType" id="foodType" class="select">
						</select>
						</span>
					</div>
					<br />
					<div>
						<label class="form-label col-xs-4 col-sm-2"><span
							style="color: red">*</span>菜品价格：</label> <input type="text"
							class="input-text" value="" placeholder="请输入菜品价格" id="foodPrice"
							name="foodPrice">
							<lable style="color: red" id="msg1"></lable>	
					</div>
					<br/>
					
					<div>			
							<span style="color: red">&nbsp&nbsp</span>菜品图片： <input type="file" name="uploadFile" id="uploadFile"/> 						
							<button id="upload" name="upload"  class="btn btn-default radius" type="button">上传</button>
					</div>
					<br />
					<div class="row cl">
						<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
							
							<input type="submit"  class="btn btn-primary" value="添加菜品">
							<button onClick="layer_close();" class="btn btn-default radius"
								type="button">取消</button>
						</div>
					</div>
			</div>
			</form>
			
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">

	
		       
        $(function () {
            $("#upload").click(function () {
               // $("#imgWait").show();
                var formData = new FormData();
                formData.append("myfile", document.getElementById("uploadFile").files[0]);   
                $.ajax({
                    url: "imgUploader",
                    type: "POST",
                    data: formData,
                    /**
                    *必须false才会自动加上正确的Content-Type
                    */
                    contentType: false,
                    /**
                    * 必须false才会避开jQuery对 formdata 的默认处理
                    * XMLHttpRequest会对 formdata 进行正确的处理
                    */
                    processData: false,
                    success: function (data) {
                            document.getElementById("foodPic").value = data.fileName;
                            alert("上传成功！");
                       // $("#imgWait").hide();
                    },
                    error: function () {
                        alert("上传失败！");
                      //  $("#imgWait").hide();
                    }
                });
            });
        });
		
		
		

</script>

<script type="text/javascript">
	$(function(){
		$.get("${pageContext.request.contextPath}/food/getFoodType",function(data){
			$.each(data, function(i,d) {	
				//$("#albumstyle").append("<li></li>");
				//$("#albumstyle").find("li").eq(i).append("<a href='4'>"+d.tName+"</a>");
				$("#foodType").append("<option value="+data[i].foodTypeId+">"+data[i].foodTypeName+"</option>");
				//$("#albumstyle").append("<li><a href='Album.do?op=altype&tId=" + d.tId + "'>" + d.tName + "</a></li>");
			
			});
		});
		
	});
	
	$("#foodName").blur(
			function() {
				var val=document.getElementById('foodName');
				var str = val.value.replace(/(^\s*)|(\s*$)/g, '');
					if (str == '' || str == undefined || str == null) {
						$("#msg").html("菜品名不能为空");
					}
					else{
						$("#msg").html("");
					}
				});
	

	$("#foodPrice").blur(
			function() {
				var val=document.getElementById('foodPrice');
				var str = val.value.replace(/(^\s*)|(\s*$)/g, '');
					if (str == '' || str == undefined || str == null) {
						$("#msg1").html("菜品价格不能为空");
					}
					else if(isNaN(val.value)){
						$("#msg1").html("请输入数字");
					}
					else{
						$("#msg1").html("");
					}
				});
			
</script>

</html>
